﻿using MagicT_API.Responsitory;
using MagicVilla_API.Data;
using MagicVilla_API.Models;
using MagicVilla_API.Responsitory.IReponsitory;

namespace MagicVilla_API.Responsitory
{
    public class VillaNumberResponsitory : Responsitory<VillaNumber>, IVillaNumberResponsitory
    {
        private readonly ApplicationDbContext _db;
        public VillaNumberResponsitory(ApplicationDbContext db) : base(db)
        {
            _db = db;
        }

        public async Task<VillaNumber> UpdateAsync(VillaNumber entity)
        {
            entity.UpdatedDate = DateTime.Now;
            _db.VillaNumbers.Update(entity);
            await _db.SaveChangesAsync();
            return entity;

        }
    }
}
